﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;

namespace HigLabo.Net.Twitter
{
    public partial class TwitterClient
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="language"></param>
        /// <param name="callback"></param>
        public void GetSuggestions(String language, Action<SuggestionCollection> callback)
        {
            var cm = new GetSuggestionsCommand();
            cm.Lang = language;
            this.GetSuggestions(cm, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetSuggestions(GetSuggestionsCommand command, Action<SuggestionCollection> callback)
        {
            this.GetResultText(TwitterApiUrl.Version1_1.Suggestions.SuggestionsUrl, command, json => callback(new SuggestionCollection(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="slug"></param>
        /// <param name="language"></param>
        /// <param name="callback"></param>
        public void GetSuggetstionsSlug(String slug, String language, Action<Suggestion> callback)
        {
            var cm = new GetSuggestionsSlugCommand();
            cm.Slug = slug;
            cm.Lang = language;
            this.GetSuggetstionsSlug(cm, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetSuggetstionsSlug(GetSuggestionsSlugCommand command, Action<Suggestion> callback)
        {
            String url = String.Format(TwitterApiUrl.Version1_1.Suggestions.SuggestionsSlugUrl, command.Slug);
            this.GetResultText(url, command, json => callback(new Suggestion(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="slug"></param>
        /// <param name="callback"></param>
        public void GetSuggestionUsers(String slug, Action<UserCollection> callback)
        {
            var cm = new GetSuggestionUsersCommand();
            cm.Slug = slug;
            this.GetSuggestionUsers(cm, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetSuggestionUsers(GetSuggestionUsersCommand command, Action<UserCollection> callback)
        {
            String url = String.Format(TwitterApiUrl.Version1_1.Suggestions.SuggestionUsersUrl, command.Slug);
            this.GetResultText(url, command, json => callback(new UserCollection(json)));
        }
    }
}
